package com.ginger.utils;

import java.io.Serializable;
import java.util.List;
import java.util.Map;
/**
 * 
 * @Description: 前端交互工具类 
 * @author 姜锋
 * @date 2018年6月27日 下午4:51:57 
 * @version V1.0   
 *
 */
public class AjaxResult implements Serializable {

	private static final long serialVersionUID = 1L;

	public boolean status = true;

	public String message;
	
	public Object obj;

	public List<?> list;

	public Map<String, Object> map;

	public AjaxResult() {}
	
	public AjaxResult(Object obj) {
		this.obj = obj;
	}

	public AjaxResult(boolean status, String message) {
		this.status = status;
		this.message = message;
	}

	public AjaxResult(List<?> list) {
		this.list = list;
	}

	public AjaxResult(Map<String, Object> map) {
		this.map = map;
	}

	public AjaxResult(boolean status, String message, List<?> list, Map<String, Object> map) {
		this.status = status;
		this.message = message;
		this.list = list;
		this.map = map;
	}

	public AjaxResult(boolean status) {
		this.status = status;
	}

	public static AjaxResult returnStatus(boolean status) {
		return new AjaxResult(status);
	}
	public static AjaxResult returnMessage(boolean status, String message) {
		return new AjaxResult(status, message);
	}
	
	public static AjaxResult returnObject(Object obj) {
		return new AjaxResult(obj);
	}
	

	public static AjaxResult returnList(List<?> list) {
		return new AjaxResult(list);
	}

	public static AjaxResult returnList(Map<String, Object> map) {
		return new AjaxResult(map);
	}

	public static AjaxResult returnResult(boolean status, String message, List<?> list, Map<String, Object> map) {
		return new AjaxResult(status, message, list, map);
	}

}
